// main.cc
#include <iostream>
#include <ctime>
#include "threadpool.hpp"
#include "Task.hpp"
using namespace std;

int main()
{
    srand(time(nullptr) ^ getpid());
    ThreadPool<Task> *tp = new ThreadPool<Task>(5);
    tp->Start();
    int len = opers.size();

    while (true)
    {
        // 1. 构建任务
        int x = rand() % 10;
        int y = rand() % 5;
        char op = opers[rand() % len];
        Task t(x, y, op);

        // 2. 交给线程池处理
        tp->Push(t);
        cout << "main thread make task: " << t.GetTask() << endl;
        sleep(1);
    } 
    return 0;
}
